/*     */ package com.qmsk.business.informake.infoFrameMake.controller;
/*     */ 
/*     */ import com.utils.file.GlobalParams;
/*     */ import com.utils.file.UploadFile;
/*     */ import com.utils.gson.out.GsonEbRst;
/*     */ import com.utils.http.HttpGsonPtResponseUtils;
/*     */ import com.utils.web.RequestUtils;
/*     */ import com.utils.web.ResponseUtils;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ import org.apache.log4j.Logger;
/*     */ import org.springframework.stereotype.Controller;
/*     */ import org.springframework.transaction.annotation.Transactional;
/*     */ import org.springframework.web.bind.annotation.PathVariable;
/*     */ import org.springframework.web.bind.annotation.RequestMapping;
/*     */ 
/*     */ @Controller
/*     */ @RequestMapping({"ptInfoFrameMake"})
/*     */ public class InfoFrameMakeController
/*     */ {
/*  25 */   private static final Logger logger = Logger.getLogger(InfoFrameMakeController.class);
/*     */   private static final String IMG_PATH = "info/img";
/*     */ 
/*     */   @RequestMapping(value={"find/shopId/{shopId}/infoId/{infoId}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListInfoId(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId, @PathVariable("infoId") String infoId)
/*     */   {
/*     */     try
/*     */     {
/*  42 */       String sData = "";
/*  43 */       String sUrl = "ptInfoFrameMake/find/shopId/" + shopId + "/infoId/" + infoId;
/*  44 */       GsonEbRst rst = HttpGsonPtResponseUtils.getPtEbRst(sUrl, sData, response);
/*  45 */       if ((rst != null) && (rst.getState() == 0)) {
/*  46 */         ResponseUtils.setResponseResult(rst, response);
/*  47 */         return; }
/*  48 */       ResponseUtils.setSqlResultResponse(0, 
/*  49 */         RequestUtils.getFindDataErrorMessage(request), 
/*  50 */         response);
/*     */     }
/*     */     catch (Exception e) {
/*  53 */       logger.error(e);
/*  54 */       ResponseUtils.setErrorMsgResponse(
/*  55 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"insert/shopId/{shopId}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void insert(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId)
/*     */   {
/*  71 */     String sGsonInData = RequestUtils.getString(request, "data");
/*     */     try {
/*  73 */       String sData = "data=" + sGsonInData;
/*  74 */       String sUrl = "ptInfoFrameMake/insert/shopId/" + shopId;
/*  75 */       GsonEbRst rst = HttpGsonPtResponseUtils.postPtEbRst(sUrl, sData, 
/*  76 */         response);
/*  77 */       if ((rst != null) && (rst.getState() == 0)) {
/*  78 */         ResponseUtils.setResponseResult(rst, response);
/*  79 */         return; }
/*  80 */       ResponseUtils.setSqlResultResponse(0, 
/*  81 */         RequestUtils.getSqlInsertDataErrorMessage(request), 
/*  82 */         response);
/*     */     }
/*     */     catch (Exception e) {
/*  85 */       logger.error(e);
/*  86 */       ResponseUtils.setErrorMsgResponse(
/*  87 */         RequestUtils.getSqlInsertDataErrorMessage(request) + ":" + 
/*  88 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"edit/shopId/{shopId}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void edit(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId)
/*     */   {
/* 105 */     String sGsonInData = RequestUtils.getString(request, "data");
/*     */     try {
/* 107 */       String sData = "data=" + sGsonInData;
/* 108 */       String sUrl = "ptInfoFrameMake/edit/shopId/" + shopId;
/* 109 */       GsonEbRst rst = HttpGsonPtResponseUtils.postPtEbRst(sUrl, sData, 
/* 110 */         response);
/* 111 */       if ((rst != null) && (rst.getState() == 0)) {
/* 112 */         ResponseUtils.setResponseResult(rst, response);
/* 113 */         return; }
/* 114 */       ResponseUtils.setSqlResultResponse(0, 
/* 115 */         RequestUtils.getSqlUpdateDataErrorMessage(request), 
/* 116 */         response);
/*     */     }
/*     */     catch (Exception e) {
/* 119 */       logger.error(e);
/* 120 */       ResponseUtils.setErrorMsgResponse(
/* 121 */         RequestUtils.getSqlUpdateDataErrorMessage(request) + ":" + 
/* 122 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"del/shopId/{shopId}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void delete(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId)
/*     */   {
/* 139 */     String id = RequestUtils.getStringOfId(request);
/*     */     try {
/* 141 */       String sData = "id=" + id;
/* 142 */       String sUrl = "ptInfoFrameMake/del/shopId/" + shopId;
/* 143 */       GsonEbRst rst = HttpGsonPtResponseUtils.postPtEbRst(sUrl, sData, 
/* 144 */         response);
/* 145 */       if ((rst != null) && (rst.getState() == 0)) {
/* 146 */         ResponseUtils.setResponseResult(rst, response);
/* 147 */         return; }
/* 148 */       ResponseUtils.setSqlResultResponse(0, 
/* 149 */         RequestUtils.getSqlDeleteDataErrorMessage(request), 
/* 150 */         response);
/*     */     }
/*     */     catch (Exception e) {
/* 153 */       logger.error(e);
/* 154 */       ResponseUtils.setErrorMsgResponse(
/* 155 */         RequestUtils.getSqlDeleteDataErrorMessage(request) + ":" + 
/* 156 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"upload/frame/{shopId}/{infoId}/{frameNo}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void uploadFrameImg(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId, @PathVariable("infoId") String infoId, @PathVariable("frameNo") String frameNo)
/*     */   {
/*     */     try
/*     */     {
/* 179 */       String path = GlobalParams.getGlobalParams().getApacheRoot() + 
/* 180 */         "info/img";
/*     */ 
/* 182 */       UploadFile.uploadFileOfRequest(request, response, path + "/" + 
/* 183 */         shopId + "/" + infoId + "/" + frameNo + "/");
/* 184 */       ResponseUtils.setSuccessResponse("上传图片成功", response);
/*     */     } catch (Exception e) {
/* 186 */       logger.error(e);
/* 187 */       ResponseUtils.setErrorMsgResponse("上传图片出错:" + e.getMessage(), 
/* 188 */         response);
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.informake.infoFrameMake.controller.InfoFrameMakeController
 * JD-Core Version:    0.5.3
 */